package com.ejlchina.common.captcha;

import java.util.Random;

/**
 * 
 * 随机数字验证码生成器
 * 
 * @author Troy
 *
 */
public class RandomNumCodeGenerator implements CodeGenerator {

	
	private Random random = new Random();

	private int length = 6;
	
	@Override
	public String generate() {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < length; i++) {
			sb.append(random.nextInt(10));
		}
		return sb.toString();
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}
	
}
